﻿cmake_minimum_required(VERSION 3.14)

project(OCR LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE  ${ROOT_PATH}/../bin)
set(OPENCV_INSTALL "Z:/software/opencv_build")

include_directories(
    "${OPENCV_INSTALL}/include"
)

find_library(OPENCV_CORE  opencv_core347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
find_library(OPENCV_VIDEO  opencv_video347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
find_library(OPENCV_VIDEOIO  opencv_videoio347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
find_library(OPENCV_HIGHGUI  opencv_highgui347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
find_library(OPENCV_CALIB3D  opencv_calib3d347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
find_library(OPENCV_IMGCODECS  opencv_imgcodecs347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
find_library(OPENCV_IMGPROC  opencv_imgproc347 HINTS ${OPENCV_INSTALL}      PATH_SUFFIXES lib)
message("*****(OPENCV_CORE)*****=${OPENCV_CORE}")
message("*****(OPENCV_VIDEO)*****=${OPENCV_VIDEO}")
message("*****(OPENCV_VIDEOIO)*****=${OPENCV_VIDEOIO}")
message("*****(OPENCV_HIGHGUI)*****=${OPENCV_HIGHGUI}")
message("*****(OPENCV_CALIB3D)*****=${OPENCV_CALIB3D}")
message("*****(OPENCV_IMGCODECS)*****=${OPENCV_IMGCODECS}")
message("*****(OPENCV_IMGPROC)*****=${OPENCV_IMGPROC}")
message("*****(OPENCV_INSTALL)*****=${OPENCV_INSTALL}")

aux_source_directory(${ROOT_PATH} SRC)

add_executable(${PROJECT_NAME}  ${SRC} )

target_link_libraries(${PROJECT_NAME}
    ${OPENCV_CORE}
    ${OPENCV_VIDEO}
    ${OPENCV_VIDEOIO}
    ${OPENCV_HIGHGUI}
    ${OPENCV_CALIB3D}
    ${OPENCV_IMGCODECS}
    ${OPENCV_IMGPROC}
)


file(COPY  ${OPENCV_INSTALL}/bin/opencv_core347.dll DESTINATION  ${ROOT_PATH}/../bin)
file(COPY  ${OPENCV_INSTALL}/bin/opencv_video347.dll DESTINATION  ${ROOT_PATH}/../bin)
file(COPY  ${OPENCV_INSTALL}/bin/opencv_videoio347.dll DESTINATION  ${ROOT_PATH}/../bin)
file(COPY  ${OPENCV_INSTALL}/bin/opencv_highgui347.dll DESTINATION  ${ROOT_PATH}/../bin)
file(COPY  ${OPENCV_INSTALL}/bin/opencv_calib3d347.dll DESTINATION  ${ROOT_PATH}/../bin)
file(COPY  ${OPENCV_INSTALL}/bin/opencv_imgcodecs347.dll DESTINATION  ${ROOT_PATH}/../bin)
file(COPY  ${OPENCV_INSTALL}/bin/opencv_imgproc347.dll DESTINATION  ${ROOT_PATH}/../bin)
